<%@ include file="/WEB-INF/views/commonJSTL.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>${s_UserPharmacy.pharmacy.name}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%@ include file="/WEB-INF/views/commonResources.jsp" %>

<script type="text/javascript">
	$(document).ready(function(){
		$("#_providerId").change(function(){
			if($("#_providerId").val() != ''){
				$("#_providerId option:selected").each(function (){
					location.href = "productReportsProviders?_menuId=5&_subMenuId=3&_optionId=2&_providerId="+$(this).val();
		        });
	        }else{
	       		location.href = "productReportsProviders?_menuId=5&_subMenuId=3&_optionId=2";
	        }
	    });	
	});
		
</script>
</head>

<body>
<div id="top-wrap">
	<%@include file="../../../head.jsp"  %>
	<div id="bodySpace">
		
	    <div class="clearfix" id="middle" style="position: absolute">  <!-- aqui va la ruta -->
	        <!-- aqui va el arbol de entrada -->
	        <div id="breadcrumb">
	            <ul>
                	<li><a href="<spring:url value="/mainFront?" htmlEscape="true" />">Home</a></li>	
                    <li><span style="color:#666"><fmt:message key="title.reports"/></span></li>		
                    <li><span style="color:#666"><fmt:message key="title.logisticsReports"/></span></li>		
                    <li class="current-page"><span class="end"><span class="middle"><fmt:message key="title.productReports"/></span></span></li>
                </ul>
	        </div>
	    </div>
	    
	    <div id="principal">
            <!-- izquierda -->
            <div class="cuerpo2y" style="border: 0px solid"><br/><br/><!-- estos break son necesarios ya q uso absolute en css  cuerpo izquierdo-->
                <div class="izq">
					<%@include file="../../../bodyIzq.jsp" %>	
                </div>
                <div class="medio" style="border: 0px solid">
					<div id="imgLoad" style="float: left;width: 100%;display: none;"><img src="<c:url value="/resources/images/imgLoad/ajax-loader.gif" />" width="32" height="32" alt="ajax-loader.gif" style="position:absolute; top:30%; left:50%;"/></div> 
					<div id="productReportsProviders">
						<br/>
						<table class="miReporte" style="width: 100%">
							<tr>
								<td>
									<label for="_providerId" ><b><fmt:message key="form.provider"/> :</b></label>					
									<select name="_providerId" id="_providerId"  title="<fmt:message key="show.form.selected.provider"/>">
										<option value="-2"><fmt:message key="show.form.selected"/></option>
										<c:forEach var="item" items="${listProvider}">
											<c:set var="selec" value="" />
		                               		<c:if test="${param._providerId == item.providerId}">
		                                		<c:set var="selec" value="selected='selected'" />
		                               		</c:if>
											<option value="${item.providerId}" ${selec}>${item.name}</option>    
										</c:forEach>
										
										<c:set var="selecAll" value="" />
										<c:if test="${param._providerId == 0}">
	                                		<c:set var="selecAll" value="selected='selected'" />
	                               		</c:if>
										<option value="0" ${selecAll}><fmt:message key="show.form.selectedAll"/></option>
									</select>
								</td>
							</tr>
						</table>
						<br/>
						<c:if test="${not empty listProduct}" >
							<h2 class="decorado"><fmt:message key="title.productReports"/></h2>
							<br/><br/>
							<table class="tabla_decorado" style="width: 100%">
								<thead>
									<tr>
										<th width="4%" class="th_decoradoRowspan"><fmt:message key="table.num"/></th>
										<th width="25%" class="th_decoradoRowspan"><fmt:message key="table.name"/></th>
										<th width="25%" class="th_decoradoRowspan"><fmt:message key="table.activePrinciple"/></th>
										<th width="16%" class="th_decoradoRowspan"><fmt:message key="table.code"/></th>
										<th width="15%" class="th_decoradoRowspan"><fmt:message key="table.surplusLevel"/></th>
										<th width="15%" class="th_decoradoRowspan"><fmt:message key="table.repositionLevel"/></th>
									</tr>
								</thead>
								<tbody>
									<c:set var="i" value="1"/>
									<c:forEach var="item" items="${listProduct}"> 
										<tr class="tr_decorado">
											<td class="th_decorado" style="text-align: center">${i}</td>
											<td class="th_decorado" style="text-align: center">${item.name}</td>
											<td class="th_decorado" style="text-align: center">${item.activeSubstanceId.name}</td>
											<td class="th_decorado" style="text-align: center">${item.code}</td>
											<td class="th_decorado" style="text-align: center">${item.pharmacyProduct.surplusLevel}</td>
											<td class="th_decorado" style="text-align: center">${item.pharmacyProduct.repositionLevel}</td>
										</tr>
										<c:set var="j" value="1"/>
										<c:set var="i" value="${i+j}"/>
									</c:forEach>
									<c:if test="${(empty listProduct)}">
		                           		<tr class="tr_decorado">
		                           			<td class="td_decorado" colspan="6" style="text-align:center"><span style="color:red"><fmt:message key="show.noExistSearchProducts"/></span></td>
		                           		</tr>
		                        	</c:if>
								</tbody>
							</table>
						</c:if>	
					</div>	                               
                </div>
            </div><!--end of leftPan-->
            <div class="yDer" style="border: 1px solid #ccc;">
                  <%@include file="../../../notices.jsp" %>                       
            </div><!--end of rightPan-->
        </div><!--end main content -->
	</div>
</div>
</body>
</html>
